package string;

import java.sql.SQLOutput;
import java.util.Locale;

public class Stringtestwork {
    public static void main(String[] args) {
        String str="我爱";
        StringBuilder builder1=new StringBuilder(str);//String转为StringBuilder
        builder1.append("java");//增加
        System.out.println(builder1);
        builder1.insert(1,"热");//插入
        System.out.println(builder1);
        int start=builder1.indexOf("热");

        builder1.replace(start,builder1.length(),"非常喜欢并努力学习");//修改
        System.out.println(builder1);
       builder1.delete(5,builder1.length());//删除
        System.out.println(builder1);
        builder1.append(",     hello world        ");
        String str1= builder1.toString();
        System.out.println(str1);
        start= str1.indexOf(",")+1;
        System.out.println(start);
        String str2=str1.substring(start,str1.length());//截取
        System.out.println(str2);
        String str3=str2.trim();
        System.out.println(str3);//去掉头尾空白
        String str4=str3.toUpperCase(Locale.ROOT);
        System.out.println(str4);//大写
        String str5=str4.toLowerCase(Locale.ROOT);
        System.out.println(str5);//小写
        char str6= str5.charAt(3);
        System.out.println(str6);//根据下标找字符串
        boolean b1=str5.startsWith("hell");
        boolean b2=str5.endsWith("ld");




    }
}
